"""catering_takeout URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from orders.views import *

urlpatterns = [
    path('add_cart/<int:id>/',Add_to_Cart.as_view()),# 添加购物车商品
    path('all_cart/<int:id>/',Shopping_all.as_view({'get':'get_cart'})),# 获取购物车商品
    path('del_cart/<int:id>/',Shopping_all.as_view({'delete':'del_cart'})),# 删除购物车某个商品
    path('jia_cart/<int:id>/',Shopping_all.as_view({'put':'jia_cart'})),# 加购物车商品的数量
    path('jian_cart/<int:id>/',Shopping_all.as_view({'put':'jian_cart'})),# 减购物车商品的数量
    path('pay/',Pay.as_view()),
    path('pay_put/',Pay_callback.as_view()),
    path('wancheng/',Pay_wancheng.as_view()),

]
from rest_framework.routers import DefaultRouter

router = DefaultRouter()

router.register('get_order', OrderView)

router.register('add_order', OrderModeView)


urlpatterns += router.urls
